﻿namespace Hidistro.UI.SaleSystem.Tags
{
    using Hidistro.Core;
    using Hidistro.Entities;
    using Hidistro.Entities.Comments;
    using Hidistro.SaleSystem.Comments;
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Xml;
    using System.Text.RegularExpressions;

    public class Common_SubjectArticle_New : WebControl
    {
        protected override void Render(HtmlTextWriter writer)
        {
            writer.Write(this.RendHtml());
        }

        public string RendHtml()
        {
            StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<ul>");

                IList<ArticleInfo> articleList = CommentBrowser.GetArticleList(0, 4);
                if ((articleList != null) && (articleList.Count > 0))
                {
                    foreach (ArticleInfo info in articleList)
                    {
                        sb.AppendFormat("<li><a target=\"_blank\" title=\"{2}\" href=\"{0}\">{1}</a></li>", 
                            Globals.GetSiteUrls().UrlData.FormatUrl("ArticleDetails", new object[] { info.ArticleId }), info.Title.Length>13?info.Title.Substring(0,12)+"...":info.Title, info.Title).AppendLine();
                    }
                    sb.AppendLine("</ul>");
                }
            
            return sb.ToString();
        }



      

    }
}

